def print_receipt_with_discount():
    # 商品信息
    items = [
        ("金士顿U盘8G", 1, 40.00),
        ("胜创16GTF卡", 1, 50.00),
        ("读卡器", 1, 8.00),
        ("网线2米", 1, 5.00),
        ("可乐", 1, 3.00)
    ]
    
    # 计算原价总金额
    total_count = len(items)
    original_total = sum(qty * price for _, qty, price in items)
    
    # 设置折扣（例如9折）
    discount_rate = 0.9
    discount_amount = original_total * (1 - discount_rate)
    discounted_total = original_total - discount_amount
    
    # 收款和找零
    received = 100.00  # 实收金额
    change = received - discounted_total
    
    # 打印小票
    print("—" * 32)
    
    print(f"单号：DH202311010001")
    print(f"时间：2023-11-01 20:56:15")
    print("-" * 32)
    
    print(f"商品名称         数量  单价   金额")
    print("-" * 32)
    
    for name, qty, price in items:
        amount = qty * price
        print(f"{name.ljust(16)}{str(qty).ljust(6)}{price:>6.2f}{amount:>7.2f}")
    
    print("-" * 32)
    print(f"总数：{total_count}")
    print(f"原价总额：{original_total:.2f}")
    print(f"折扣：{discount_rate * 10:.1f}折")  # 显示为X.X折
    print(f"优惠金额：{discount_amount:.2f}")
    print(f"折后总额：{discounted_total:.2f}")
    print(f"实收：{received:.2f}")
    print(f"找零：{change:.2f}")
    print(f"收银：管理员")
    print("-" * 32)

# 执行打印
print_receipt_with_discount()